<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript">
			
		</script>
	</head>
	<body>
		<div id="div1">
			<h2>当前计数：{{counter}}</h2>
			<!-- <button v-on:click="counter++" type="button">+</button>
			<button v-on:click="counter--" type="button">-</button> -->
			<button v-on:click="add" type="button">+</button>
			<button v-on:click="sub" type="button">-</button>
		</div>
	</body>
	<script type="text/javascript">
		const div1 = new Vue({
			el:"#div1",
			data:{
				counter:0
			},
			methods:{
				add:function(){
					this.counter++;
				},
				sub:function(){
					this.counter--;
				}
			}
		})
	</script>
</html>
